﻿<UserControl x:Class="Resxus.View.FileListView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:model="clr-namespace:Resxus.Model"
    Height="Auto" Width="Auto">
    <UserControl.Resources>
        <DataTemplate x:Key="CheckTemplate" DataType="{x:Type model:ResourceFile}">
            <CheckBox IsChecked="{Binding IsChecked}"/>
        </DataTemplate>
        <ContextMenu x:Key="FileListContextMenu">                        
            <MenuItem Header="추가" Command="{Binding AddCommand}"/>
            <MenuItem Header="삭제" Command="{Binding DeleteCommand}"/>            
        </ContextMenu>
    </UserControl.Resources>
    <Grid>
        <ListView
            ItemsSource="{Binding Files}"                      
            SelectedItem="{Binding SelectedItem}" 
            ContextMenu="{StaticResource FileListContextMenu}"
            >                       
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                    <!--<Setter Property="ContextMenu" Value="{StaticResource FileListContextMenu}"/>-->
                    <EventSetter Event="MouseDoubleClick" Handler="ListView_MouseDoubleClick"/>
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>                    
                    <GridViewColumn 
                        Width="Auto"                                                             
                        CellTemplate="{StaticResource CheckTemplate}"                        
                        >
                        <GridViewColumn.Header>
                            <CheckBox IsChecked="{Binding IsAllChecked}"/>
                        </GridViewColumn.Header>
                    </GridViewColumn>
                    <GridViewColumn 
                        DisplayMemberBinding="{Binding Name}"
                        Width="100" 
                        Header="File Name"/>
                    <GridViewColumn 
                        DisplayMemberBinding="{Binding Culture}"
                        Width="180" 
                        Header="Culture"/>
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</UserControl>
